package beans;

import java.io.Serializable;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

@Entity
@NamedQueries({
  @NamedQuery(name = "Subject.findAll", query = "select o from Subject o order by o.id"),
  @NamedQuery(name = "Subject.findByID", query = "select o from Subject o where o.id = :subjectId")
})
public class Subject
  implements Serializable
{
  private String description;
  @Id
  @Column(nullable = false)
  private Long id;
  private String title;
  @OneToMany(mappedBy = "subject", cascade = CascadeType.ALL)
  private List<Pulje> puljeList;
  @OneToMany(mappedBy = "subject", cascade = CascadeType.ALL)
  private List<Studentsubject> studentsubjectList;
  @OneToMany(mappedBy = "subject", cascade = CascadeType.ALL)
  private List<Priority> priorityList;

  public Subject()
  {
  }

  public Subject(String description, Long id, String title)
  {
    this.description = description;
    this.id = id;
    this.title = title;
  }

  public String getDescription()
  {
    return description;
  }

  public void setDescription(String description)
  {
    this.description = description;
  }

  public Long getId()
  {
    return id;
  }

  public void setId(Long id)
  {
    this.id = id;
  }

  public String getTitle()
  {
    return title;
  }

  public void setTitle(String title)
  {
    this.title = title;
  }

  public List<Pulje> getPuljeList()
  {
    return puljeList;
  }

  public void setPuljeList(List<Pulje> puljeList)
  {
    this.puljeList = puljeList;
  }

  public Pulje addPulje(Pulje pulje)
  {
    getPuljeList().add(pulje);
    pulje.setSubject(this);
    return pulje;
  }

  public Pulje removePulje(Pulje pulje)
  {
    getPuljeList().remove(pulje);
    pulje.setSubject(null);
    return pulje;
  }

  public List<Studentsubject> getStudentsubjectList()
  {
    return studentsubjectList;
  }

  public void setStudentsubjectList(List<Studentsubject> studentsubjectList)
  {
    this.studentsubjectList = studentsubjectList;
  }

  public Studentsubject addStudentsubject(Studentsubject studentsubject)
  {
    getStudentsubjectList().add(studentsubject);
    studentsubject.setSubject(this);
    return studentsubject;
  }

  public Studentsubject removeStudentsubject(Studentsubject studentsubject)
  {
    getStudentsubjectList().remove(studentsubject);
    studentsubject.setSubject(null);
    return studentsubject;
  }

  public List<Priority> getPriorityList()
  {
    return priorityList;
  }

  public void setPriorityList(List<Priority> priorityList)
  {
    this.priorityList = priorityList;
  }

  public Priority addPriority(Priority priority)
  {
    getPriorityList().add(priority);
    priority.setSubject(this);
    return priority;
  }

  public Priority removePriority(Priority priority)
  {
    getPriorityList().remove(priority);
    priority.setSubject(null);
    return priority;
  }
}
